<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>表格界面(预览)</title>
    <link rel="stylesheet" type="text/css" href="${s.base}/lib/layui/css/layui.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/css/base/index.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/css/base/theme/theme.css"/>
</head>
<body>
<#assign hasTopFunction =
(formTool?? && (formTool.addFunction?substring(0,1)=='1'))
|| (formTool?? && (formTool.editFunction?substring(0,1)=='1'))
|| (formTool?? && (formTool.deleteFunction?substring(0,1)=='1'))>
<#assign hasTableFunction =
(formTool?? && (formTool.addFunction?substring(2,3)=='2'))
|| (formTool?? && (formTool.editFunction?substring(2,3)=='2'))
|| (formTool?? && (formTool.deleteFunction?substring(2,3)=='2'))>
<#assign showLaydate = false>
<#if (formSearchVoList??) && (formSearchVoList?size>0)>
<#list formSearchVoList as formSearchVo>
<#if formSearchVo.type == 'dateTime'>
<#assign showLaydate = true>
<#break>
</#if>
</#list>
</#if>
<div class="wrap-container clearfix">
    <div class="column-content-detail">
        <#if hasTopFunction || (formSearchVoList?? && (formSearchVoList?size>0))>
        <form class="layui-form">
            <div class="search-cont clearfix" id="tool">
                <div class="operation-btn-cont">
                    <#if (formSearchVoList??) && (formSearchVoList?size>0)>
                    <div class="operright cyt-retract-close hideMenu"> 收起筛选<i class="iconfont">&#xe658;</i></div>
                    <div class="operright cyt-retract-open showMenu" style="display: none;"> 展开筛选<i class="iconfont">&#xe936;</i></div>
                    </#if>
                    <!--button开始-->
                    <#if formTool?? && (formTool.addFunction?substring(0,1)=='1')>
                    <button class="layui-btn layui-btn-normal layui-btn-mid" type="button" id="addBtn"><i class="iconfont marr5">&#xe65e;</i>添加</button>
                    </#if>
                    <#if formTool?? && (formTool.editFunction?substring(0,1)=='1')>
                    <button class="layui-btn layui-btn-normal layui-btn-mid" type="button" id="editBtn"><i class="iconfont marr5">&#xe606;</i>编辑</button>
                    </#if>
                    <#if formTool?? && (formTool.deleteFunction?substring(0,1)=='1')>
                    <button class="layui-btn layui-btn-normal layui-btn-mid" type="button" id="deleteBtn"><i class="iconfont marr5">&#xe6a3;</i>删除</button>
                    </#if>
                    <!--button结束-->
                    <#if (formSearchVoList??) && (formSearchVoList?size>0)>
                    <div class="triangle-bottom"></div>
                    <div class="triangle-top"></div>
                    </#if>
                </div>
                <#if (formSearchVoList??) && (formSearchVoList?size>0)>
                <div class="search-details">
                    <div class="layui-form-item marb5">
                        <!--search开始-->
                        <#list formSearchVoList as formSearchVo>
                        <#if formSearchVo.type == 'input'>
                        <div class="layui-inline">
                            <label class="layui-form-label">${formSearchVo.name}：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="${formSearchVo.field}" placeholder="请输入${formSearchVo.name}" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <#elseif formSearchVo.type == 'select'>
                        <div class="layui-inline">
                            <label class="layui-form-label">${formSearchVo.name}：</label>
                            <div class="layui-input-inline">
                                <select name="${formSearchVo.field}" id="${formSearchVo.field}">
                                </select>
                            </div>
                        </div>
                        <#elseif formSearchVo.type == 'dateTime'>
                        <div class="layui-inline">
                            <label class="layui-form-label">${formSearchVo.name}：</label>
                            <div class="layui-input-inline">
                                <input type="text" id="${formSearchVo.field}" name="${formSearchVo.field}" placeholder="请输入${formSearchVo.name}" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <#else>
                        </#if>
                        </#list>
                        <!--search结束-->
                        <div class="layui-inline marl8">
                            <button class="layui-btn layui-btn-normal" type="button" lay-submit="" lay-filter="seacherBtn">搜索</button>
                            <button class="layui-btn layui-btn-normal" type="reset">重置</button>
                        </div>
                    </div>
                </div>
                </#if>
            </div>
        </form>
        </#if>
        <div class="layui-form" id="table-list">
            <table id="entityList" lay-filter="entityList" class="cy-list-table"></table>
        </div>
    </div>
</div>
<!--操作-->
<#if hasTableFunction>
<script type="text/html" id="entityBar">
    <#if formTool.addFunction?substring(2,3)=='2'>
    <a class="layui-btn layui-btn-radius layui-btn-primary layui-btn-sm layui-smbtn-purple"  lay-event="add">添加</a>
    </#if>
    <#if formTool.editFunction?substring(2,3)=='2'>
    <a class="layui-btn layui-btn-radius layui-btn-primary layui-btn-sm layui-smbtn-green"  lay-event="edit">编辑</a>
    </#if>
    <#if formTool.deleteFunction?substring(2,3)=='2'>
    <button type="button" class="layui-btn layui-btn-radius layui-btn-primary layui-btn-sm layui-smbtn-red" lay-event="delete">删除</button>
    </#if>
</script>
</#if>
<script src="${s.base}/lib/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="${s.base}/js/common.js" type="text/javascript" charset="utf-8"></script>
<script>
    var tableIns = null;
    layui.use(['jquery', 'page'<#if showLaydate>, 'laydate'</#if>], function () {
        var $ = layui.jquery,
            page = layui.page<#if showLaydate>,<#else>;</#if>
            <#if showLaydate>
            laydate = layui.laydate;
            </#if>
        <#assign initIndex=0>
        <#if (formSearchVoList??) && (formSearchVoList?size>0)>
        <#list formSearchVoList as formSearchVo>
        <#if formSearchVo.type == 'dateTime'>
        <#if initIndex == 0>

        //初始化时间控件
        </#if>
        <#assign initIndex++>
        laydate.render({elem: '#${formSearchVo.field}', type: '${formSearchVo.format}'});
        </#if>
        </#list>
        </#if>
        <#if (allSelect?? && allSelect != '')>

        //获取分页数据
        page.initDict('${allSelect}', function (dictData) {
            <#if (searchSelectList??) && (searchSelectList?size>0)>
            <#list searchSelectList as searchSelect>
            page.showDict($("#${searchSelect.field}"), page.aceeptDictContentList(dictData, '${searchSelect.code}'), "全部");
            </#list>
            </#if>
            var url = '/gen/form/pagePreview';
            var cols = [
                {type: 'checkbox', fixed: 'left'},
                <#if (formShowVoList??) && (formShowVoList?size>0)>
                <#list formShowVoList as formShowVo>
                <#if formShowVo.type == 'input'>
                {field: '${formShowVo.field}', title: '${formShowVo.name}', align: 'center'}<#if formShowVo_index!=(formShowVoList?size-1)>,<#else><#if hasTableFunction>,</#if></#if>
                <#elseif formShowVo.type == 'select'>
                {
                    field: '${formShowVo.field}', title: '${formShowVo.name}', align: 'center', templet: function (d) {
                            return page.aceeptDictContentName(dictData, '${formShowVo.code}', d.${formShowVo.field});
                    }
                }<#if formShowVo_index!=(formShowVoList?size-1)>,<#else><#if hasTableFunction>,</#if></#if>
                <#elseif formShowVo.type == 'dateTime'>
                {
                    field: '${formShowVo.field}', title: '${formShowVo.name}', align: 'center', templet: function (d) {
                        return new Date(d.${formShowVo.field}).Format("${formShowVo.format}");
                    }
                }<#if formShowVo_index!=(formShowVoList?size-1)>,<#else><#if hasTableFunction>,</#if></#if>
                </#if>
                </#list>
                </#if>
                <#if hasTableFunction>
                {title: '操作', width: 170, templet: '#entityBar' ,align: "center"}
                </#if>
            ];
            tableIns = page.initDate(cols, url);
        });
        <#else>

        //获取分页数据
        var url = '/gen/form/pagePreview';
        var cols = [
            {type: 'checkbox', fixed: 'left'},
            <#if (formShowVoList??) && (formShowVoList?size>0)>
            <#list formShowVoList as formShowVo>
            <#if formShowVo.type == 'input'>
            {field: '${formShowVo.field}', title: '${formShowVo.name}', align: 'center'}<#if formShowVo_index!=(formShowVoList?size-1)>,<#else><#if hasTableFunction>,</#if></#if>
            <#elseif formShowVo.type == 'select'>
            {
                field: '${formShowVo.field}', title: '${formShowVo.name}', align: 'center', templet: function (d) {
                    return page.aceeptDictContentName(dictData, '${formShowVo.code}', d.${formShowVo.field});
                }
            }<#if formShowVo_index!=(formShowVoList?size-1)>,<#else><#if hasTableFunction>,</#if></#if>
            <#elseif formShowVo.type == 'dateTime'>
            {
                field: '${formShowVo.field}', title: '${formShowVo.name}', align: 'center', templet: function (d) {
                    return new Date(d.${formShowVo.field}).Format("${formShowVo.format}");
                }
            }<#if formShowVo_index!=(formShowVoList?size-1)>,<#else><#if hasTableFunction>,</#if></#if>
            </#if>
            </#list>
            </#if>
            <#if hasTableFunction>
            {title: '操作', width: 170, templet: '#entityBar', align: "center"}
            </#if>
        ];
        tableIns = page.initDate(cols, url);
        </#if>
    });
</script>
</body>
</html>